package com.itheima.导入和导出;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;

public class Thread_into extends Thread{
    @Override
    public void run() {
        synchronized(Thread_into.class){
            try {
                ZipInputStream zip = new ZipInputStream(new FileInputStream("D:\\z.zip"));
                FileOutputStream fos = new FileOutputStream("diary/src/Text/mytext");
                ZipEntry entry;
                while((entry = zip.getNextEntry())!=null){
                    int b;
                    while((b=zip.read())!=-1){
                        fos.write(b);
                    }
                }
                fos.close();
                zip.closeEntry();
                zip.close();
            } catch (IOException ex) {
                throw new RuntimeException(ex);
            }
        }
    }
}
